//
//  ZLookFriendTableViewCell.m
//  DoctorFAQs
//
//  Created by zjq on 17/2/17.
//  Copyright © 2017年 zjq. All rights reserved.
//

#import "ZLookFriendTableViewCell.h"
#import "ZConsumerView.h"
#import "ZLabelTools.h"
@interface ZLookFriendTableViewCell () {
    ZConsumerView * _headView; //用户一栏
    UILabel * _problemLabel;// 问题
    UIView * _garyView; // 灰色视图
    UIImageView * _AImageView; // 答图片
    UILabel * _answerLabel;// 答案
    UIImageView * _doctorView;
    UILabel * _doctorNameLabel;
    UILabel * _hospitalNameLabel;
    UILabel * _levelLabel;
    UIView * _garyView2 ;// 下面的灰色视图
}


@end
@implementation ZLookFriendTableViewCell

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        [self initlizeInterface];
    }
    return self;
}

- (void)setCvModel:(ZCVModel *)cvModel {
    _cvModel = cvModel;
    _headView.model = _cvModel;
}
- (void)setIllModel:(ZillFModel *)illModel {
    _illModel = illModel;
//    UILabel * _problemLabel;// 问题
//    UIView * _garyView; // 灰色视图
//    UIImageView * _AImageView; // 答图片
//    UILabel * _answerLabel;// 答案
//    UIImageView * _doctorView;
//    UILabel * _doctorNameLabel;
//    UILabel * _hospitalNameLabel;
//    UILabel * _levelLabel;
    _problemLabel.text = illModel.title;
    _answerLabel.text = illModel.content;
    [_doctorView sd_setImageWithURL:[NSURL URLWithString:illModel.d_pic] placeholderImage:[UIImage imageNamed:@"about-us"]];
    _doctorNameLabel.text = illModel.d_name;
    _hospitalNameLabel.text = illModel.hospital;
    _levelLabel.text = illModel.job_title;
}

-(void)initlizeInterface {
    [self makeALLSubView];

}
-(void)makeALLSubView {
     _headView = [[ZConsumerView alloc] init];
//     _headView.layer.cornerRadius = 
    _problemLabel = [[UILabel alloc] init];
    [ZLabelTools setThelabel:_problemLabel Textcolor:[UIColor blackColor] backColor:[UIColor whiteColor] Fontsize:16 context:@""isCenter:NO];
    _problemLabel.numberOfLines = 3;
    _garyView = [[UIView alloc] init];
    _garyView.backgroundColor = KHColorFromRGB(0xf8f8f8);
    _AImageView = [[UIImageView alloc] init];
    _AImageView.image = [UIImage imageNamed:@"icon_answer"];
    _answerLabel = [[UILabel alloc] init];
    [ZLabelTools setThelabel:_answerLabel Textcolor:[UIColor blackColor] backColor:[UIColor clearColor] Fontsize:14 context:@"" isCenter:NO];
    _answerLabel.numberOfLines = 3;
    _doctorView = [[UIImageView alloc] init];
    _doctorView.layer.cornerRadius = 10*xsIZE;
    _doctorView.layer.masksToBounds = YES;
    _doctorNameLabel = [[UILabel alloc] init];
    [ZLabelTools setThelabel:_doctorNameLabel Textcolor:KHGreenColor backColor:[UIColor clearColor] Fontsize:13 context:@"XXX" isCenter:NO];
    _hospitalNameLabel = [[UILabel alloc] init];
    [ZLabelTools setThelabel:_hospitalNameLabel Textcolor:KHGaryColor backColor:[UIColor clearColor] Fontsize:11 context:@"XXXXXX" isCenter:NO];
    _levelLabel = [[UILabel alloc] init];
    [ZLabelTools setThelabel:_levelLabel Textcolor:KHGreenColor backColor:[UIColor clearColor] Fontsize:11 context:@"XXXXX" isCenter:NO];
    _garyView2 = [[UIView alloc] init];
    _garyView2.backgroundColor = KHColorFromRGB(0xf8f8f8);
    [self addALLSubView];
}
- (void)addALLSubView {
    [self.contentView addSubview:_headView];
    [self.contentView addSubview:_problemLabel];
    [self.contentView addSubview:_garyView];
    [self.contentView addSubview:_AImageView];
    [self.contentView addSubview:_answerLabel];
    [self.contentView addSubview:_doctorView];
    [self.contentView addSubview:_doctorNameLabel];
    [self.contentView addSubview:_hospitalNameLabel];
    [self.contentView addSubview:_levelLabel];
    [self.contentView addSubview:_garyView2];
    [self makeSubViewMasnoy];
}
- (void)makeSubViewMasnoy {
    [_headView mas_remakeConstraints:^(MASConstraintMaker *make) {
        make.left.width.equalTo(self.contentView);
        make.top.equalTo(self.contentView).offset(10*ysIZE);
        make.top.equalTo(self.contentView).offset(15*ysIZE);
        make.height.offset(30*ysIZE);
    }];
    [_problemLabel mas_remakeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self).offset(13*xsIZE);
        make.right.equalTo(self).offset(-15*xsIZE);
        make.top.equalTo(_headView).offset(40*ysIZE);
        make.height.offset(65*ysIZE);
    }];
    [_garyView mas_remakeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.contentView).offset(13*xsIZE);
        make.right.equalTo(self.contentView).offset(-15*xsIZE);
        make.top.equalTo(_problemLabel.mas_bottom).offset(13*ysIZE);
        make.height.offset(115*ysIZE);
    }];
    [_AImageView mas_remakeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(_garyView);
        make.left.equalTo(_garyView).offset(3*xsIZE);
        make.height.offset(28*ysIZE);
        make.width.offset(20*xsIZE);
    }];
    [_answerLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(_garyView).offset(5*xsIZE);
        make.right.equalTo(_garyView).offset(-10*xsIZE);
        make.height.offset(45*ysIZE);
        make.top.equalTo(_AImageView.mas_bottom).offset(5*ysIZE);
    }];
    [_doctorView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.height.width.offset(20*xsIZE);
        make.top.equalTo(_answerLabel.mas_bottom).offset(10*ysIZE);
        make.left.equalTo(_answerLabel);
    }];
    [_doctorNameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(_doctorView);
        make.height.offset(13*ysIZE);
        make.width.offset(50*xsIZE);
        make.left.equalTo(_doctorView.mas_right).offset(5*xsIZE);
    }];
    [_hospitalNameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(_doctorNameLabel.mas_right);
        make.height.centerY.equalTo(_doctorNameLabel);
        make.width.offset(75*xsIZE);
    }];
    [_levelLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(_hospitalNameLabel.mas_right);
        make.height.centerY.equalTo(_doctorNameLabel);
        make.width.offset(75*xsIZE);
    }];
    [_garyView2 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.width.bottom.equalTo(self.contentView);
        make.height.offset(10*ysIZE);
        
    }];
}

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
